Full source code website bán hàng thương mại điện tử gần giống shopee
468.796 lượt xem;
1 <?php
2 include("../ckeditor/ckeditor.php");
3 ?>
4 <script type="text/javascript" src="../ckeditor/ckeditor.js"></script>
5 <script type="text/javascript" src="../ckeditor/ckfinder/ckfinder.js"></script>
6 <?
7 $path="../upload";
8 $pathdb="upload";
9
10 if (isset($_POST['butSaveLoai'])) {
11 $id=$_POST['ddContent'];
12 $desc=$_POST['txtDesc'];
13 $link=$_POST['txtDescen'];
14 $imageSmall=$_FILES['txtImage'];
15
16 $err="";
17 $err.=CheckUpload($_FILES["txtImage"],".jpg;.gif;.swf;.bmp;.avi;.wma;.dat;.mp3;.wmv",3000*1024,0);
18
19 if ($err=="")
20 {
21 if (mysql_query("update info set content='".$desc."',link='".$link."' where id='".$id."'",$con)) {
22 if ($_POST['chkClear']=='')
23 {
24 $sqlUpdateField = "";
25 $extsmall=GetFileExtention($_FILES['txtImage']['name']);
26 if (MakeUpload($_FILES['txtImage'],"$path/content_s$id$extsmall"))
27 {
28 @chmod("$path/content_s$id$extsmall", 0777);
29 $sqlUpdateField = " image='$pathdb/content_s$id$extsmall' ";
30 }
31
32 }
33 else
34 {
35 $pro=GetContentInfo($id);
36 if (file_exists("../".$pro['image'])) unlink("../".$pro['image']);
37 $sqlUpdateField = " image='' ";
38 }
39 if($sqlUpdateField)
40 {
41 $sqlUpdate = "update info set $sqlUpdateField where id='".$id."'";
42 mysql_query($sqlUpdate,$con);
43 }
44 }
45 else {
46 $err = "<p align=center class='err'>Không thể cập nhật</p>";
47 }
48 if ($err=='') echo "<p align=center class='err'>Đã cập nhật thành công</p>";
49 //if ($err=='') echo '<script>window.location="index.php?act=content&id='.$_REQUEST['id'].'&code=1"</script>';
50 }
51 if ($err!="") echo "<p align=center class='err'>".$err."</p>";
52 }
53 $id=1;
54 if ($_REQUEST['id']!='') $id=$_REQUEST['id'];
55 $cont=GetContentInfo($id);
56 $desc=$cont['content'];
57 $link=$cont['link'];
58 ?>
59
60
61 <form method="post" name="FormLoaiSP" enctype="multipart/form-data" action="index.php?">
62 <input type="hidden" name="act" value="content">
63 <input type="hidden" name="id" value="<? echo $_REQUEST['id']; ?>">
64 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
65 <tr>
66 <td width="45%" class="title" align="center">Cập nhật: Nội dung</td>
67 </tr>
68 <tr>
69 <td width="45%">
70 <table border="0" cellpadding="2" bordercolor="#111111" width="100%" id="AutoNumber2" cellspacing="0">
71 <tr>
72 <td width="99%" class="smallfont" colspan="4" align="center">
73 <? if ($cont['image']!='') { ?>
74 <img border="0" src="../<? echo $cont['image']; ?>">
75 <? } ?>
76 </td>
77 </tr>
78 <tr>
79 <td width="15%" class="smallfont">
80 <p align="right">Chọn nội dung</td>
81 <td width="1%" class="smallfont" align="center">
82 <font color="#FF0000">*</font></td>
83 <td width="4%" class="smallfont">
84 <select size="1" name="ddContent">
85 <?
86 $list=GetListContent();
87 $id=$_REQUEST['id'];
88 foreach ($list as $c)
89 {
90 if ($id=="") $id=$c[0];
91 if ($c[0]!==$_REQUEST['id'])
92 echo '<option value="'.$c[0].'">'.$c[1].'</option>';
93 else
94 echo '<option selected value="'.$c[0].'">'.$c[1].'</option>';
95 }
96 ?>
97 </select></td>
98 <td width="79%" class="smallfont">
99 <input type="button" value="Chuyển" name="B1" class="button" onclick="javascript:window.location='./?act=content&id='+ddContent.value"></td>
100 </tr>
101 <tr>
102 <td width="15%" class="smallfont" align="right">
103 Hình ảnh</td>
104 <td width="1%" class="smallfont" align="center">
105 </td>
106 <td width="83%" class="smallfont" colspan="2">
107 <INPUT TYPE="file" NAME="txtImage" CLASS=textbox size="34"><input type="checkbox" name="chkClear" value="ON">Xóa
108 bỏ hình</td>
109 </tr>
110
111 <?if($_REQUEST['id']==8){?>
112 <tr>
113 <td width="15%" class="smallfont" align="right">
114 Người nhận</td>
115 <td width="1%" class="smallfont" align="center">
116 </td>
117 <td width="83%" class="smallfont" colspan="2">
118 <textarea rows="2" name="txtDescen" cols="60"><? echo $link; ?></textarea>
119 </td></tr>
120 <?} else {?>
121 <tr>
122 <td width="15%" class="smallfont" align="right">
123 Link</td>
124 <td width="1%" class="smallfont" align="center">
125 </td>
126 <td width="83%" class="smallfont" colspan="2">
127
128 <input type="text" name="txtDescen" value="<? echo $link; ?>" style="width:500px">
129
130
131
132
133
134
135
136 <textarea id="txtDescen" name="txtDescen" rows="10" cols="80"><? echo $link; ?></textarea>
137
138 <script type="text/javascript">
139
140 // This is a check for the CKEditor class. If not defined, the paths must be checked.
141 if ( typeof CKEDITOR == 'undefined' )
142 {
143 document.write(
144 '<strong><span style="color: #ff0000">Error</span>: CKEditor not found</strong>.' +
145 'This sample assumes that CKEditor (not included with CKFinder) is installed in' +
146 'the "/ckeditor/" path. If you have it installed in a different place, just edit' +
147 'this file, changing the wrong paths in the <head> (line 5) and the "BasePath"' +
148 'value (line 32).' ) ;
149 }
150 else
151 {
152 var editor = CKEDITOR.replace( 'txtDescen' );
153 editor.setData( '<p><? echo $link; ?></p>' );
154
155 // Just call CKFinder.setupCKEditor and pass the CKEditor instance as the first argument.
156 // The second parameter (optional), is the path for the CKFinder installation (default = "/ckfinder/").
157 CKFinder.setupCKEditor( editor, '../' ) ;
158
159 // It is also possible to pass an object with selected CKFinder properties as a second argument.
160 // CKFinder.setupCKEditor( editor, { basePath : '../', skin : 'v1' } ) ;
161 }
162
163 </script>
164 </td>
165 </tr>
166 <?}?>
167
168
169 <?if($_REQUEST['id']==8){?>
170 <tr>
171 <td width="15%" class="smallfont" align="right">
172 Người nhận</td>
173 <td width="1%" class="smallfont" align="center">
174 </td>
175 <td width="83%" class="smallfont" colspan="2">
176 <textarea rows="2" name="txtDesc" cols="60"><? echo $desc; ?></textarea>
177 </td></tr>
178 <?} else {?>
179 <tr>
180 <td width="15%" class="smallfont" align="right">
181 Nội dung</td>
182 <td width="1%" class="smallfont" align="center">
183 </td>
184 <td width="83%" class="smallfont" colspan="2">
185 <p>
186 <textarea name="txtDesc" cols="60" rows="20"><? echo $desc; ?></textarea>
187 </p>
188 <?php
189 $CKEditor = new CKEditor();
190 $CKEditor->basePath = '../ckeditor/';
191 $CKEditor->replace("txtDesc");
192 ?>
193 </td>
194 </tr>
195 <?}?>
196
197
198
199
200
201
202
203 <tr>
204 <td width="15%" class="smallfont" colspan="2">
205 <p align="right">
206 <INPUT TYPE="submit" NAME="butSaveLoai" VALUE="Cập nhật" CLASS=button onclick="submitForm()"> </td>
207 <td width="84%" class="smallfont" align="center" colspan="2">
208 <p align="left"> <INPUT TYPE="reset" CLASS=button value="Nhập lại"></td>
209 </tr>
210 </table>
211 </td>
212 </tr>
213 </table>
214 </form>
2 include("../ckeditor/ckeditor.php");
3 ?>
4 <script type="text/javascript" src="../ckeditor/ckeditor.js"></script>
5 <script type="text/javascript" src="../ckeditor/ckfinder/ckfinder.js"></script>
6 <?
7 $path="../upload";
8 $pathdb="upload";
9
10 if (isset($_POST['butSaveLoai'])) {
11 $id=$_POST['ddContent'];
12 $desc=$_POST['txtDesc'];
13 $link=$_POST['txtDescen'];
14 $imageSmall=$_FILES['txtImage'];
15
16 $err="";
17 $err.=CheckUpload($_FILES["txtImage"],".jpg;.gif;.swf;.bmp;.avi;.wma;.dat;.mp3;.wmv",3000*1024,0);
18
19 if ($err=="")
20 {
21 if (mysql_query("update info set content='".$desc."',link='".$link."' where id='".$id."'",$con)) {
22 if ($_POST['chkClear']=='')
23 {
24 $sqlUpdateField = "";
25 $extsmall=GetFileExtention($_FILES['txtImage']['name']);
26 if (MakeUpload($_FILES['txtImage'],"$path/content_s$id$extsmall"))
27 {
28 @chmod("$path/content_s$id$extsmall", 0777);
29 $sqlUpdateField = " image='$pathdb/content_s$id$extsmall' ";
30 }
31
32 }
33 else
34 {
35 $pro=GetContentInfo($id);
36 if (file_exists("../".$pro['image'])) unlink("../".$pro['image']);
37 $sqlUpdateField = " image='' ";
38 }
39 if($sqlUpdateField)
40 {
41 $sqlUpdate = "update info set $sqlUpdateField where id='".$id."'";
42 mysql_query($sqlUpdate,$con);
43 }
44 }
45 else {
46 $err = "<p align=center class='err'>Không thể cập nhật</p>";
47 }
48 if ($err=='') echo "<p align=center class='err'>Đã cập nhật thành công</p>";
49 //if ($err=='') echo '<script>window.location="index.php?act=content&id='.$_REQUEST['id'].'&code=1"</script>';
50 }
51 if ($err!="") echo "<p align=center class='err'>".$err."</p>";
52 }
53 $id=1;
54 if ($_REQUEST['id']!='') $id=$_REQUEST['id'];
55 $cont=GetContentInfo($id);
56 $desc=$cont['content'];
57 $link=$cont['link'];
58 ?>
59
60
61 <form method="post" name="FormLoaiSP" enctype="multipart/form-data" action="index.php?">
62 <input type="hidden" name="act" value="content">
63 <input type="hidden" name="id" value="<? echo $_REQUEST['id']; ?>">
64 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
65 <tr>
66 <td width="45%" class="title" align="center">Cập nhật: Nội dung</td>
67 </tr>
68 <tr>
69 <td width="45%">
70 <table border="0" cellpadding="2" bordercolor="#111111" width="100%" id="AutoNumber2" cellspacing="0">
71 <tr>
72 <td width="99%" class="smallfont" colspan="4" align="center">
73 <? if ($cont['image']!='') { ?>
74 <img border="0" src="../<? echo $cont['image']; ?>">
75 <? } ?>
76 </td>
77 </tr>
78 <tr>
79 <td width="15%" class="smallfont">
80 <p align="right">Chọn nội dung</td>
81 <td width="1%" class="smallfont" align="center">
82 <font color="#FF0000">*</font></td>
83 <td width="4%" class="smallfont">
84 <select size="1" name="ddContent">
85 <?
86 $list=GetListContent();
87 $id=$_REQUEST['id'];
88 foreach ($list as $c)
89 {
90 if ($id=="") $id=$c[0];
91 if ($c[0]!==$_REQUEST['id'])
92 echo '<option value="'.$c[0].'">'.$c[1].'</option>';
93 else
94 echo '<option selected value="'.$c[0].'">'.$c[1].'</option>';
95 }
96 ?>
97 </select></td>
98 <td width="79%" class="smallfont">
99 <input type="button" value="Chuyển" name="B1" class="button" onclick="javascript:window.location='./?act=content&id='+ddContent.value"></td>
100 </tr>
101 <tr>
102 <td width="15%" class="smallfont" align="right">
103 Hình ảnh</td>
104 <td width="1%" class="smallfont" align="center">
105 </td>
106 <td width="83%" class="smallfont" colspan="2">
107 <INPUT TYPE="file" NAME="txtImage" CLASS=textbox size="34"><input type="checkbox" name="chkClear" value="ON">Xóa
108 bỏ hình</td>
109 </tr>
110
111 <?if($_REQUEST['id']==8){?>
112 <tr>
113 <td width="15%" class="smallfont" align="right">
114 Người nhận</td>
115 <td width="1%" class="smallfont" align="center">
116 </td>
117 <td width="83%" class="smallfont" colspan="2">
118 <textarea rows="2" name="txtDescen" cols="60"><? echo $link; ?></textarea>
119 </td></tr>
120 <?} else {?>
121 <tr>
122 <td width="15%" class="smallfont" align="right">
123 Link</td>
124 <td width="1%" class="smallfont" align="center">
125 </td>
126 <td width="83%" class="smallfont" colspan="2">
127
128 <input type="text" name="txtDescen" value="<? echo $link; ?>" style="width:500px">
129
130
131
132
133
134
135
136 <textarea id="txtDescen" name="txtDescen" rows="10" cols="80"><? echo $link; ?></textarea>
137
138 <script type="text/javascript">
139
140 // This is a check for the CKEditor class. If not defined, the paths must be checked.
141 if ( typeof CKEDITOR == 'undefined' )
142 {
143 document.write(
144 '<strong><span style="color: #ff0000">Error</span>: CKEditor not found</strong>.' +
145 'This sample assumes that CKEditor (not included with CKFinder) is installed in' +
146 'the "/ckeditor/" path. If you have it installed in a different place, just edit' +
147 'this file, changing the wrong paths in the <head> (line 5) and the "BasePath"' +
148 'value (line 32).' ) ;
149 }
150 else
151 {
152 var editor = CKEDITOR.replace( 'txtDescen' );
153 editor.setData( '<p><? echo $link; ?></p>' );
154
155 // Just call CKFinder.setupCKEditor and pass the CKEditor instance as the first argument.
156 // The second parameter (optional), is the path for the CKFinder installation (default = "/ckfinder/").
157 CKFinder.setupCKEditor( editor, '../' ) ;
158
159 // It is also possible to pass an object with selected CKFinder properties as a second argument.
160 // CKFinder.setupCKEditor( editor, { basePath : '../', skin : 'v1' } ) ;
161 }
162
163 </script>
164 </td>
165 </tr>
166 <?}?>
167
168
169 <?if($_REQUEST['id']==8){?>
170 <tr>
171 <td width="15%" class="smallfont" align="right">
172 Người nhận</td>
173 <td width="1%" class="smallfont" align="center">
174 </td>
175 <td width="83%" class="smallfont" colspan="2">
176 <textarea rows="2" name="txtDesc" cols="60"><? echo $desc; ?></textarea>
177 </td></tr>
178 <?} else {?>
179 <tr>
180 <td width="15%" class="smallfont" align="right">
181 Nội dung</td>
182 <td width="1%" class="smallfont" align="center">
183 </td>
184 <td width="83%" class="smallfont" colspan="2">
185 <p>
186 <textarea name="txtDesc" cols="60" rows="20"><? echo $desc; ?></textarea>
187 </p>
188 <?php
189 $CKEditor = new CKEditor();
190 $CKEditor->basePath = '../ckeditor/';
191 $CKEditor->replace("txtDesc");
192 ?>
193 </td>
194 </tr>
195 <?}?>
196
197
198
199
200
201
202
203 <tr>
204 <td width="15%" class="smallfont" colspan="2">
205 <p align="right">
206 <INPUT TYPE="submit" NAME="butSaveLoai" VALUE="Cập nhật" CLASS=button onclick="submitForm()"> </td>
207 <td width="84%" class="smallfont" align="center" colspan="2">
208 <p align="left"> <INPUT TYPE="reset" CLASS=button value="Nhập lại"></td>
209 </tr>
210 </table>
211 </td>
212 </tr>
213 </table>
214 </form>